package com.bamboocloud.im.config;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @Auther xuwen
 * @Date 2021/12/9 16:24
 * @Version 1.0
 */
@Configuration//标记是一个配置类
public class configbean {
    @Bean
    @LoadBalanced    //配置负载均衡实现(Ribbon)
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }


    //自己定义一个轮询算法
/*    @Bean
    public IRule myrule(){
        return new RandomRule();
    }*/

}
